CONTENTS | INDEX | PREV | NEXT
getenv
NAME
getenv - get enviroment variable
SYNOPSIS
char *var = getenv(const char *name);
FUNCTION
getenv() searches for and returns the ENV: enviroment variable
requested. getenv() will cache variables so that requesting
the same variable repetitously does not allocate a new memory
buffer.
getenv() allocates a buffer for each variable returned, so you
do not have to copy the return value from getenv(). This memory
is freed on program exit. Do not attempt to free() a getenv()'d
variable!!
EXAMPLE
#include <stdio.h>
#include <stdlib.h>
main(ac, av)
int ac;
char *av[];
{
char *dccopts = getenv("DCCOPTS");
if (dccopts)
printf("DCCOPTS = %sn", dccopts);
else
printf("You do not have a DCCOPTS enviroment variable!n");
return(0);
}
INPUTS
char *name; Name of enviroment variable, on the amiga this
is not case sensitive. On UNIX systems it is.
RESULTS
char *var; contents of enviroment variable or NULL if the
variable could not be found.
SEE ALSO